#ifndef __IRPROP_PLUS_H__
#define __IRPROP_PLUS_H__

#include "Optimizer.h"
#include "../ClEvent.h"
#include "../ClMem.h"
#include <vector>

namespace learn {

struct IRpropPlus : Optimizer {	
	IRpropPlus(cl_command_queue _queue, int modelParameterCount, float initialDeltaW = 0.01f);
	virtual ~IRpropPlus();
	
	float getStepIncreaseFactor();
	void setStepIncreaseFactor(float value);
	
	float getStepDecreaseFactor();
	void setStepDecreaseFactor(float value);
	
	float getStepMaxIncrement();
	void setStepMaxIncrement(float value);
	
	float getStepMinIncrement();
	void setStepMinIncrement(float value);
		
	virtual float optimize(Model &model, ErrorFunction &errorFunction, OptimizationSupervisor &data);
protected:
	float stepIncreaseFactor;
	float stepDecreaseFactor;
	float stepMaxIncrement;
	float stepMinIncrement;
	float prevError;
	
	ClMem<float> deltaW;
	ClMem<float> prevdEdW;
	ClMem<float> delta;
private:
	cl_command_queue queue;
	cl_kernel fill;
	cl_kernel iRpropPlus;
	
	ClEvent iRpropPlusAsync(ClMem<float> parameters, ClMem<float> dEdW, float currentError);
};

}

#endif // __IRPROP_PLUS_H__